package com.smartstate.admin.biz.entity.bo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.smartstate.admin.biz.entity.dto.PermissionDto;
import com.smartstate.admin.biz.entity.vo.PermissionVo;
import com.smartstate.common.base.entity.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import javax.persistence.Entity;
import java.io.Serializable;

@Data
@Entity
@NoArgsConstructor
@TableName("permission")
public class Permission extends BaseEntity<PermissionVo,PermissionDto> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 权限名称
     */
    private String name;

    /**
     * 权限编码
     */
    private String code;

    /**
     * 路径
     */
    private String urlPath;

    /**
     * 父级权限
     */
    private String pid;

    /**
     * 菜单类型 （0菜单 1按钮）
     */
    private Integer type;

    /**
     * 图标
     */
    private String icon;

    /**
     * 排序
     */
    private Integer sort;

    /**
     * 是否有效(0无效，1有效)
     */
    private Integer status;

    /**
     * pc端和移动端：0:pc,1:app
     */
    private Integer isWeb;
    /**
     * 组件
     */
    private String component;

    public Permission buildBo(PermissionDto permissionDto){
        BeanUtils.copyProperties(permissionDto,this);
        return this;
    }

    public PermissionVo getVo() {
        PermissionVo permissionVo = new PermissionVo();
        return permissionVo;
    }
}